package net.takela.common.security.service;

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken;
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;

import java.util.Date;

public class TokenRepositoryImpl implements PersistentTokenRepository {
    
    /**
     * 
     */
    @Override
    public void createNewToken(PersistentRememberMeToken token) {
        //getJdbcTemplate().update(this.insertTokenSql, token.getUsername(), token.getSeries(), token.getTokenValue(),
        //				token.getDate());
        System.out.println("=== craetenewToken:"+token);
    }

    
    /**
     * 
     */
    @Override
    public void updateToken(String series, String tokenValue, Date lastUsed) {
        //getJdbcTemplate().update(this.updateTokenSql, tokenValue, lastUsed, series);
        System.out.println("=== updateToken:"+series+tokenValue+lastUsed);
    }

    
    /**
     * 
     */
    @Override
    public PersistentRememberMeToken getTokenForSeries(String seriesId) {
        //return getJdbcTemplate().queryForObject(this.tokensBySeriesSql, this::createRememberMeToken, seriesId);
        System.out.println("=== getTokenForSeries:"+seriesId);
        return null;
    }

    
    /**
     * 
     */
    @Override
    public void removeUserTokens(String username) {
        //getJdbcTemplate().update(this.removeUserTokensSql, username);
    }
}
